package file;

import java.io.File;

/**
 * 说明:
 *
 * @author:SuZhongHe
 * @date:2023/3/6
 **/
public class ListFilesDemo {
    public static void main(String[] args) {
        File file = new File(".");
        if (file.isDirectory()) {
            System.out.println("是目录且文件存在");
        } else {
            System.out.println("不是目录或者文件不存在");
        }
        File[] files = file.listFiles();
        System.out.println("有"+files.length+"个子项");
        for (File file1 : files) {
            System.out.println(file1.getName());
        }
    }

}
